package com.ms3ds.mineInfo.service.impl;

import java.util.List;
import com.ms3ds.common.core.utils.DateUtils;
import com.ms3ds.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ms3ds.mineInfo.mapper.OreTypeMapper;
import com.ms3ds.mineInfo.api.domain.OreType;
import com.ms3ds.mineInfo.service.IOreTypeService;

/**
 * 矿物种类Service业务层处理
 * 
 * @author zlw
 * @date 2025-09-15
 */
@Service
public class OreTypeServiceImpl implements IOreTypeService 
{
    @Autowired
    private OreTypeMapper oreTypeMapper;

    /**
     * 查询矿物种类
     * 
     * @param id 矿物种类主键
     * @return 矿物种类
     */
    @Override
    public OreType selectOreTypeById(Long id)
    {
        return oreTypeMapper.selectOreTypeById(id);
    }

    /**
     * 查询矿物种类列表
     * 
     * @param oreType 矿物种类
     * @return 矿物种类
     */
    @Override
    public List<OreType> selectOreTypeList(OreType oreType)
    {
        return oreTypeMapper.selectOreTypeList(oreType);
    }

    /**
     * 新增矿物种类
     * 
     * @param oreType 矿物种类
     * @return 结果
     */
    @Override
    public int insertOreType(OreType oreType)
    {
        Long userId = SecurityUtils.getUserId();
        oreType.setCreateBy(String.valueOf(userId));
        oreType.setCreateTime(DateUtils.getNowDate());
        return oreTypeMapper.insertOreType(oreType);
    }

    /**
     * 修改矿物种类
     * 
     * @param oreType 矿物种类
     * @return 结果
     */
    @Override
    public int updateOreType(OreType oreType)
    {
        Long userId = SecurityUtils.getUserId();
        oreType.setUpdateBy(String.valueOf(userId));
        oreType.setUpdateTime(DateUtils.getNowDate());
        return oreTypeMapper.updateOreType(oreType);
    }

    /**
     * 批量删除矿物种类
     * 
     * @param ids 需要删除的矿物种类主键
     * @return 结果
     */
    @Override
    public int deleteOreTypeByIds(Long[] ids)
    {
        return oreTypeMapper.deleteOreTypeByIds(ids);
    }

    /**
     * 删除矿物种类信息
     * 
     * @param id 矿物种类主键
     * @return 结果
     */
    @Override
    public int deleteOreTypeById(Long id)
    {
        return oreTypeMapper.deleteOreTypeById(id);
    }
}
